using System;
using System.Collections;
using System.Data;
using System.Data.Common;
using System.Collections.Generic;

using WHC.Pager.Entity;
using Microsoft.Practices.EnterpriseLibrary.Data;
using WHC.Hotel.Entity;
using WHC.Hotel.IDAL;
using WHC.OrderWater.Commons;

namespace WHC.Hotel.DAL
{
	/// <summary>
	/// TeaBackConsumerList 的摘要说明。
	/// </summary>
	public class KTVBackConsumerList : BaseDAL<KTVBackConsumerListInfo>, IKTVBackConsumerList
	{
		#region 对象实例及构造函数

		public static KTVBackConsumerList Instance
		{
			get
			{
				return new KTVBackConsumerList();
			}
		}
		public KTVBackConsumerList() : base("YL_KTVBackConsumerList","ID")
		{
		}

		#endregion

		/// <summary>
		/// 将DataReader的属性值转化为实体类的属性值，返回实体类
		/// </summary>
		/// <param name="dr">有效的DataReader对象</param>
		/// <returns>实体类对象</returns>
		protected override KTVBackConsumerListInfo DataReaderToEntity(IDataReader dataReader)
		{
			KTVBackConsumerListInfo teaBackConsumerListInfo = new KTVBackConsumerListInfo();
			SmartDataReader reader = new SmartDataReader(dataReader);
			
			teaBackConsumerListInfo.ID = reader.GetInt32("ID");
			teaBackConsumerListInfo.Order_ID = reader.GetInt32("Order_ID");
			teaBackConsumerListInfo.OrderNo = reader.GetString("OrderNo");
			teaBackConsumerListInfo.RoomNo = reader.GetString("RoomNo");
            teaBackConsumerListInfo.ItemType = reader.GetString("ItemType");
            teaBackConsumerListInfo.ItemNo = reader.GetString("ItemNo");
			teaBackConsumerListInfo.ItemName = reader.GetString("ItemName");
			teaBackConsumerListInfo.Reason = reader.GetString("Reason");
			teaBackConsumerListInfo.Price = reader.GetDecimal("Price");
			teaBackConsumerListInfo.Discount = reader.GetDouble("Discount");
			teaBackConsumerListInfo.DiscountPrice = reader.GetDecimal("DiscountPrice");
            teaBackConsumerListInfo.Quantity = reader.GetDouble("Quantity");
			teaBackConsumerListInfo.Amount = reader.GetDecimal("Amount");
			teaBackConsumerListInfo.OrderTime = reader.GetDateTime("OrderTime");
			teaBackConsumerListInfo.Creator = reader.GetString("Creator");
			
			return teaBackConsumerListInfo;
		}

		/// <summary>
		/// 将实体对象的属性值转化为Hashtable对应的键值
		/// </summary>
		/// <param name="obj">有效的实体对象</param>
		/// <returns>包含键值映射的Hashtable</returns>
        protected override Hashtable GetHashByEntity(KTVBackConsumerListInfo obj)
		{
		    KTVBackConsumerListInfo info = obj as KTVBackConsumerListInfo;
			Hashtable hash = new Hashtable(); 
			
 			hash.Add("Order_ID", info.Order_ID);
 			hash.Add("OrderNo", info.OrderNo);
 			hash.Add("RoomNo", info.RoomNo);
            hash.Add("ItemType", info.ItemType);
            hash.Add("ItemNo", info.ItemNo);
 			hash.Add("ItemName", info.ItemName);
 			hash.Add("Reason", info.Reason);
 			hash.Add("Price", info.Price);
 			hash.Add("Discount", info.Discount);
 			hash.Add("DiscountPrice", info.DiscountPrice);
 			hash.Add("Quantity", info.Quantity);
 			hash.Add("Amount", info.Amount);
 			hash.Add("OrderTime", info.OrderTime);
 			hash.Add("Creator", info.Creator);
 				
			return hash;
		}

    }
}